<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
    *{
        padding: 0px;
        margin: 0px;
    }

    li{
        width: 300px;
        height: 400px;
        margin-right: 5px;
        margin-bottom: 5px;
        display: inline-block;
        border: 1px black;
    }
    img{
        width: 100%;
    }
</style>
<body>
    <input type="text" placeholder="Search...">
    <button>点击</button>
    <ul></ul>
</body>
<script src="./axios.js"></script>
<script>
    var oBtn=document.querySelector('button')
    var oUl=document.querySelector('ul')
    var oIpt=document.querySelector('input')
    var str=''
    oBtn.onclick=function(){
        axios({
    method:'get',
    url:' http://localhost:8888/goods/list',
    params:{
        current:1,
        pagesize:12,
        search:oIpt.value,
        filter:{},
        saleType:10,
        sortType:'id',  
        sortMethod:'ASC',
        category:null,
    },
}).then(function(res){
    console.log(res);
    var arr = res.data.list
    for(var i=0;i<arr.length;i++){
            str += `
                <li>
                    <a href='数据.html?goodsid=${arr[i].goods_id}'><img src='${arr[i].img_big_logo}'></img>
                    <h5>${arr[i].title}</h5>
                    <p>${arr[i].price}</p> 
                </li>
            `

        }
        oUl.innerHTML=str
})

    }

</script>
</html>